home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / fido / tdisp11.lha / TrapDispatcher / Rexx / CallExist.rexx next >
OS/2 REXX Batch file  |  1994-11-15  |  2KB  |  73 lines

  1. /*
  2.  
  3.    CallExist.rexx 1.2
  4.  
  5.    Calls a node using TrapDispatcher if there is netmail, echomail or
  6.    filerequests for that node. CallExist.rexx won't call if there only
  7.    is mail on hold, of course.
  8.  
  9.    CallExist only recognizes a 4D-style outbound directory, that is the
  10.    files should be named zone.net.node.point.*. Does anybode use the old
  11.    2D-style anyway?
  12.  
  13.  
  14.    New in 1.1:
  15.  
  16.    Parameters passes on command-line after the node number will be
  17.    passed on to TrapDispatcher. That means that you can do this:
  18.  
  19.    rx CallExist.rexx 2:203/600 RETRIES 100
  20.  
  21.    New in 1.2:
  22.  
  23.    Now shows the result string if an error occurs. Requires
  24.    TrapDispatcher  1.1.
  25.  
  26. */
  27.  
  28. /* Change these to suit your system */
  29.  
  30. dispatchport="TRAPDISPATCHER"
  31. outbound="MAIL:Outbound"
  32.  
  33. /* Real script starts here */
  34.  
  35. options results
  36. options failat 11 /* Don't show error 10 in CLI... */
  37.  
  38. if right(outbound,1)~=":" & right(outbound,1)~="/" then
  39.  outbound=outbound || '/'
  40.  
  41. parse arg node" "opt
  42.  
  43. parse var node zone":"net"/"node"."point
  44. if point="" then point=0
  45.  
  46. basename=outbound || zone"."net"."node"."point
  47.  
  48. call=FALSE
  49.  
  50. if exists(basename || ".FLO") then call=TRUE
  51. if exists(basename || ".CLO") then call=TRUE
  52. if exists(basename || ".DLO") then call=TRUE
  53. if exists(basename || ".OUT") then call=TRUE
  54. if exists(basename || ".CUT") then call=TRUE
  55. if exists(basename || ".DUT") then call=TRUE
  56. if exists(basename || ".REQ") then call=TRUE
  57.  
  58. addr=zone":"net"/"node"."point
  59.  
  60. if call=TRUE then do
  61.  address value dispatchport
  62.  'call 'addr' 'opt
  63.  if rc~=0 then do
  64.   geterror
  65.   say "Call failed:" result
  66.  end
  67. end
  68. else do
  69.  say "No mail, won't call "addr"..."
  70. end
  71.  
  72.  
  73.